package com.redbox.RedboxManagment.controllers;

import java.util.List;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.redbox.RedboxManagment.ejb.Client;
import com.redbox.RedboxManagment.ejb.OrderStatus;
import com.redbox.RedboxManagment.service.IClientService;
import com.redbox.RedboxManagment.service.IOrderService;
import com.redbox.RedboxManagment.service.IOrderStatusService;
import com.redbox.RedboxManagment.service.IUserService;

@Controller
public class OrderController {
	
	@Autowired
	private IOrderService orderService;
	
	@Autowired
	private IClientService clientService;
	
	@Autowired
	private IOrderStatusService orderStatusService;

	@RequestMapping(value = "**/addOrderPage", method = RequestMethod.GET)
	@Transactional
	public ModelAndView addOrderPage (Locale locale, Model model,HttpServletRequest request) {
		
		ModelAndView x = new ModelAndView();
		List<OrderStatus> orderStatusList = orderStatusService.retrieveAllOrderStatus();
		List<Client> clientList = clientService.retrieveAllClients();
		
		x.addObject("orderStatusList", orderStatusList);
		x.addObject("clientList", clientList);
			
		return x;
	}
	
//	@RequestMapping(value = "**/addOrderPage/addOrder", method = RequestMethod.POST)
//	@Transactional
//	public ModelAndView addOrder (Locale locale, Model model,HttpServletRequest request) {
//		
//		ModelAndView x = new ModelAndView();
//
//		String userName = (String)request.getParameter("txtUser");
//		
//		
//			
//		return x;
//	}

}
